let vm = new Vue({

el:'#app',

delimiters:['[[',']]'],
data:{
username:'',
password:'',

user_message:'',
pass_message:'',
error_username:false,
error_password:false,


},

methods:{

//check_username(){
//
//let url='usernames/'+this.username+'/count/';
//axios.get(url,{
//responseType:'json',
//})
//.then(response=>{
//if(response.data.count==0){
//    this.error_username=true;
//    this.user_message='用户名不存在';
//}else{
//    this.error_username=false;
//
//}
//})
//.catch(error=>{
//this.error_username=true;
//this.user_message='网络连接失败';
//
//})
//
//},
check_password(){
let re = /^[0-9A-Za-z]{8,20}$/;
   if (re.test(this.password)) {
       this.error_password = false;
    } else {
      this.error_password = true;
      this.pass_message='请输入正确的密码';
    }

},
on_submit(){
this.check_username();
this.check_password();

if(this.error_username==true||this.error_password == true){
window.event.returnValue=false
}
},


qq_login(){
let next = get_query_string('next') || '/';
let url = '/qq/login/?next=' + next;
axios.get(url,{
responseType:'json'
})
.then(response=>{
location.href = response.data.login_url;
})

.catch(error => {
console.log(error.response);
                    })
},

},































});



